

void UI_TrimAmountOptions::destroy() {
    PF_SETTINGS->beginGroup("/Modify");
    PF_SETTINGS->writeEntry("/TrimAmount", leDist->text());
    PF_SETTINGS->endGroup();
}

void UI_TrimAmountOptions::setAction(PF_ActionInterface* a, bool update) {
    if (a!=NULL && a->rtti()==LX_Define::ActionModifyTrimAmount) {
        action = (WF_ModifyTrimAmount*)a;

        QString sd;
        // settings from action:
        if (update) {
            sd = QString("%1").arg(action->getDistance());
        }
        // settings from config file:
        else {
            PF_SETTINGS->beginGroup("/Modify");
            sd = PF_SETTINGS->readEntry("/TrimAmount", "1.0");
            PF_SETTINGS->endGroup();
        }

        leDist->setText(sd);
    } else {
        PF_DEBUG->print(PF_Debug::D_ERROR, 
			"QG_ModifyTrimAmountOptions::setAction: wrong action type");
        this->action = NULL;
    }
}

void UI_TrimAmountOptions::updateDist(const QString& d) {
    if (action!=NULL) {
        action->setDistance(PF_Math::eval(d, 1.0));
    }
}
